function [posRow,outStru]=assignXTicksQuarterly(sampleVec,Nticks,sampleCell) 
if nargin < 3 || isempty(sampleCell); 
    sampleCell=sample2date(sampleVec);     
end 
Ndates=length(sampleVec); 
if nargout > 1 
outStru.xtickValues=zeros(Nticks,1); 
outStru.xtickLabels=cell(Nticks,1); 
end 
%% Less ticks than dates 
if Ndates <=Nticks || Ndates < 5
    posRow=(1:Ndates); 
    if nargout > 1
        outStru.xtickValues=sampleVec;
        outStru.xtickLabels=sampleCell;
    end
    return     
end 
if Ndates==5 || Ndates == 6
    posRow=[1,3,5];
elseif Ndates ==7 || Ndates==8
    posRow=[1,4,7];
elseif Ndates > 8 && Ndates < 16
    posRow=(1:3:(Ndates-rem(Ndates,4)));
else
    posRow=round( linspace(1,Ndates,Nticks) );
end
if nargout > 1
    outStru.xtickValues=sampleVec(posRow);
    outStru.xtickLabels=sampleCell(posRow);
end
